<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

/**
 * 活动控制器
 */
class HealthRoom extends AdminBase
{
    /**
     *获取当前用户所在的活动的健康小屋列表，并显示在页面上，供活动小屋科添加概况，维护专家团队，查看专家评价
     */
    public function activityRecord()
    {
        $dept_id=session('department_info')['id'];
        $list=$this->logicHealthroom->getHealthroomList(['room_id'=>$dept_id]);
        $this->assign('list',$list);
        return $this->fetch('healthroom_list');
    }

     /**
     *获取当前用户所在的活动的健康小屋列表，并显示在页面上，供活动小屋科添加概况，维护专家团队，查看专家评价
     */
    public function activityList()
    {
        $list=$this->logicActivity->getActivityList(['room_id'=>$this->param['room_id']]);
        $this->assign('list',$list);
        $dlist=parse_config_array('activity_type');
       $this->assign('dlist',$dlist);
        return $this->fetch('activity_list');
    }

    public function lastActivityList()
    {
        $dept_id=session('department_info')['id'];
        $list=$this->logicActivity->getLastActivityList($dept_id);
        $dlist=parse_config_array('activity_type');
        $this->assign('dlist',$dlist);
        $this->assign('list',$list);
        return $this->fetch('last_activity_list');
    }

    /**
     * 活动提醒
     */
    public function activityReminder()
    {

  
    }

    public function activityDetailManage($activity_id=0)  //活动详情列表（管理）
    {
        $this->assign('activity_id',$activity_id); 

        $list=$this->logicActivityDetail->getActivityDetailList($activity_id);
        
        $this->assign('list',$list);
        $dlist=parse_config_array('activity_type');
       $this->assign('dlist',$dlist);        

        return $this->fetch('activity_detail_list');
    }

    //增加活动详情记录
    public function activityDetailAdd($activity_id=0)
    {
        
        IS_POST && $this->jump($this->logicActivityDetail->activityDetailAdd($this->param));

        $this->assign('activity_id',$activity_id);

        $alist=parse_config_array('activity_type');
        $this->assign('activity_list',$alist);

        $llist=parse_config_array('lecture_type');

        $this->assign('lecture_list',$llist);

        $slist=parse_config_array('feedback_level');
        $this->assign('feedback_level_list',$slist);
   
        return $this->fetch('activity_detail_add');
    }

    public function activityDetailEdit($activity_id=0,$id=0)
    {
        
        IS_POST && $this->jump($this->logicActivityDetail->activityDetailEdit($this->param));
        $this->assign('activity_id',$activity_id);
        $alist=parse_config_array('activity_type');
        $this->assign('activity_list',$alist);

        $slist=parse_config_array('feedback_level');
        $this->assign('feedback_level_list',$slist);

        $info = $this->logicActivityDetail->getActivityDetailInfo(['id' =>$id]);
        $info['intro'] = html_entity_decode($info['intro']);

        $this->assign('info', $info);

        return $this->fetch('activity_detail_edit');
    }
    
    /**
     * 活动记录删除
     */
    public function activityDetailDel($id = 0)
    {
        
        $this->jump($this->logicActivityDetail->activityDetailDel(['id' => $id]));
    }


    /**
     * 资料上传
     */
    public function activityUpload($id=0)
    {
    IS_POST && jump($this->logicActivity->activityUpload($this->param));

    $lst=$this->logicActivity->getActivityList(['id'=>$id]);
    $this->assign('lst',$lst);
    $info=$this->logicActivity->getActivityDetailList(['activity_id'=>$this->param['id']]);
    $this->assign('info',$info);
    return $this->fetch('activity_upload');
    }

/**
 * 打印问卷调查表
 */
     public function paperPrint()
     {
        return $this->fetch('paper_print');
     }

}
